package com.seeTools.next.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @Author: seeTools
 * @Date: 2024/5/17  9:52
 * @Version 1.0
 */
@Getter
@AllArgsConstructor
public enum CouponTypeEnum {

    FULL("0", "满减券"),

    CASH("1", "现金券"),

    STORE("2", "商品券"),

    SERVER("3", "服务券"),

    DISCOUNT("4", "折扣券"),
    ;


    /**
     * 券类型编码
     */
    private final String code;

    /**
     * 券类型名称
     */
    private final String name;


    /**
     * 获取指定枚举
     *
     * @param code
     * @return
     */
    public static CouponTypeEnum getEnum(String code) {
        for (CouponTypeEnum item : CouponTypeEnum.values()) {
            if (code.equals(item.getCode())) {
                return item;
            }
        }
        return null;
    }

}
